﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Tour.BLL;
using Tour.DAL;
public partial class Tourist_EventList : System.Web.UI.Page
{
    public static int PageSize = 8;
    public int PageIndex { get; set; }
    public string TypeTextID { get; set; }
    public string EventTypeTextId { get; set; }
    protected void Page_Load(object sender, EventArgs e)
    {
        PageIndex = CommonHelper.QueryStringInt("page", 1);
        TypeTextID = CommonHelper.QueryString("TypeTextID");
        EventTypeTextId = CommonHelper.QueryString("EventTypeTextId");
        if (!IsPostBack)
        {
            LoadData();
            LoadDataEventtype();

        }
    }
    void LoadData()
    {
        int TotalRow = 0;
        //rpt.DataSource = TblEventManager.CreateInstant().SelectTblEventBy(null, null,TypeTextID, "", null, PageSize, PageIndex, out TotalRow, "CreatedDate", "DESC");        
        rpt.DataSource = TblEventManager.CreateInstant().SelectTblEventBy(null, null, EventTypeTextId, "", true, PageSize, PageIndex, out TotalRow, "CreatedDate", "DESC");

        rpt.DataBind();
        smartPager.PageSize = PageSize;
        smartPager.QueryStringKey = "page";
        smartPager.RowCount = TotalRow;
        //smartPager.UrlFormatString = UrlBuilder.GetEventListPagingUrl(TypeTextID);
        smartPager.UrlFormatString = UrlBuilder.GetEventListPagingUrl(EventTypeTextId);
        smartPager.Visible = TotalRow > PageSize;
    }
    void LoadDataEventtype()
    {
        rptEventType.DataSource = TblEventTypeManager.CreateInstant().SelectTblEventTypeBy(null, null, EventTypeTextId, true, "CreatedDate", "DESC");
        rptEventType.DataBind();
    }
}